package com.hanrui.android.adapter;

import android.text.TextUtils;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hanrui.android.GlideApp;
import com.hanrui.android.R;
import com.hanrui.android.model.MainMessigeListBean;

/**
 * 主页（消息）
 * Created by Administrator on 2018/2/9.
 */

public class MainMessigeAdapter extends BaseQuickAdapter<MainMessigeListBean,BaseViewHolder> {

    public MainMessigeAdapter(){ super(R.layout.item_mainmessige); }

    @Override
    protected void convert(BaseViewHolder helper, MainMessigeListBean item) {

        GlideApp.with(mContext).load(item.getIcon()).into((ImageView) helper.getView(R.id.messige_icon));

        helper.setText(R.id.messige_title,item.getTitle());

        if (!TextUtils.isEmpty(item.getNum())) {

            helper.setGone(R.id.badgeview,true);
            helper.setText(R.id.badgeview,item.getNum());

        		}else {

            helper.setVisible(R.id.badgeview,false);
        }
    }
}